package com.example.springbootredis.service.impl;

import com.example.springbootredis.repository.MemberRepository;
import com.example.springbootredis.service.MemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.lang.reflect.Member;
import java.util.Optional;

@Service
public class MemberServiceImpl implements MemberService {

    @Autowired
    private MemberRepository memberRepository;

    @Override
    public Optional<Member> findByUsername(String Username) {
        return memberRepository.findById(Long.valueOf(Username));
    }
    @Override
    public Member save(Member member) {
        return memberRepository.save(member);
    }
    @Override
    public boolean existsByUsername(String username) {
        return memberRepository.existsByUsername(username);
    }
}
